using UnityEngine;

[RequireComponent(typeof(PointTrigger_Player))]
public abstract class GearWithTrigger : Gear
{
    protected PointTrigger_Player trigger;

    protected override void Awake()
    {
        base.Awake();
        trigger = GetComponent<PointTrigger_Player>();
        if (trigger != null)
            trigger.OnTriggerStay += MyOnTriggerStay;
    }

    protected virtual void MyOnTriggerStay(Player player)
    {
        if (open)
            return;
        if (CanOpen(player) && Input.GetKeyDown(KeyCode.F))
            Open();
    }
}